From 8082dcada868659f5ccf67b6ef7689b546217c02 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Tue, 29 Jul 2014 18:11:51 -0700 Subject: [PATCH] Register new snapshots --- .travis.yml | 5 +++-- Makefile.in | 4 ++-- src/bin/cargo-version.rs | 2 +- src/cargo/lib.rs | 2 +- src/etc/dl-snapshot.py | 39 +++++++++++++++++++++++------------ src/etc/print-new-snapshot.py | 16 ++++++++++---- src/snapshots.txt | 7 +++++++ 7 files changed, 52 insertions(+), 23 deletions(-) diff --git a/.travis.yml b/.travis.yml index 273749079..b897f3577 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,9 +4,10 @@ install: - sh ./.travis.install.deps.sh script: + - ./configure --local-rust-root=`pwd`/rustc - make - - make test -j4 - - make install DESTDIR=${PWD}/destdir + - make test + - make distcheck env: - BITS=32 diff --git a/Makefile.in b/Makefile.in index bb3d5084a..6bd1b75e5 100644 --- a/Makefile.in +++ b/Makefile.in @@ -47,7 +47,7 @@ BIN_TARGETS_$(1) := $$(BIN_TARGETS:%=$$(TARGET_$(1))/%$$(X)) endef $(foreach target,$(CFG_TARGET),$(eval $(call DIST_TARGET,$(target)))) -CARGO := $(TARGET_ROOT)/snapshot/cargo-nightly/bin/cargo$(X) +CARGO := $(TARGET_ROOT)/snapshot/bin/cargo$(X) all: $(foreach target,$(CFG_TARGET),cargo-$(target)) @@ -58,7 +58,7 @@ endef $(foreach target,$(CFG_TARGET),$(eval $(call CARGO_TARGET,$(target)))) $(CARGO): src/snapshots.txt - $(CFG_PYTHON) src/etc/dl-snapshot.py + $(CFG_PYTHON) src/etc/dl-snapshot.py $(CFG_BUILD) touch $@ diff --git a/src/bin/cargo-version.rs b/src/bin/cargo-version.rs index 4c5b1e0d2..b31374135 100644 --- a/src/bin/cargo-version.rs +++ b/src/bin/cargo-version.rs @@ -27,7 +27,7 @@ fn main() { fn execute(_: Options, _: &mut MultiShell) -> CliResult> { debug!("executing; cmd=cargo-version; args={}", os::args()); - println!("cargo {}", env!("CFG_VERSION")); + println!("{}", cargo::version()); Ok(None) } diff --git a/src/cargo/lib.rs b/src/cargo/lib.rs index 50925ae7c..3a8bfeaaa 100644 --- a/src/cargo/lib.rs +++ b/src/cargo/lib.rs @@ -197,7 +197,7 @@ fn handle_cause(err: &CargoError, shell: &mut MultiShell) { } pub fn version() -> String { - (env!("CFG_VERSION")).to_string() + format!("cargo {}", env!("CFG_VERSION")) } fn flags_from_args(args: &[String], diff --git a/src/etc/dl-snapshot.py b/src/etc/dl-snapshot.py index eb8b5cb38..aeee64dfc 100644 --- a/src/etc/dl-snapshot.py +++ b/src/etc/dl-snapshot.py @@ -4,27 +4,35 @@ import os import subprocess import sys import tarfile +import shutil f = open('src/snapshots.txt') lines = f.readlines() date = lines[0] -mac = lines[1] -linux = lines[2] -win = lines[3] - -if 'linux' in sys.platform: - me = linux -elif sys.platform == 'win32': - me = win -elif sys.platform == 'darwin': - me = mac +linux32 = lines[1] +linux64 = lines[2] +mac32 = lines[3] +mac64 = lines[4] +win32 = lines[5] +triple = sys.argv[1] + +if triple == 'i686-unknown-linux-gnu': + me = linux32 +elif triple == 'x86_64-unknown-linux-gnu': + me = linux64 +elif triple == 'i686-apple-darwin': + me = mac32 +elif triple == 'x86_64-apple-darwin': + me = mac64 +elif triple == 'i686-pc-mingw32': + me = win32 else: - raise Exception("no snapshot for the platform: " + sys.platform) + raise Exception("no snapshot for the triple: " + triple) platform, hash = me.strip().split(' ') -tarball = 'cargo-nightly-' + platform + '.tar.gz' +tarball = 'cargo-nightly-' + triple + '.tar.gz' url = 'http://static.rust-lang.org/cargo-dist/' + date.strip() + '/' + tarball dl_path = "target/dl/" + tarball dst = "target/snapshot" @@ -32,6 +40,9 @@ dst = "target/snapshot" if not os.path.isdir('target/dl'): os.makedirs('target/dl') +if os.path.isdir(dst): + shutil.rmtree(dst) + ret = subprocess.call(["curl", "-o", dl_path, url]) if ret != 0: raise Exception("failed to fetch url") @@ -41,8 +52,10 @@ if h != hash: tar = tarfile.open(dl_path) for p in tar.getnames(): - name = p.replace("cargo-nightly/", "", 1) + name = p.replace("cargo-nightly-" + triple + "/", "", 1) fp = os.path.join(dst, name) print("extracting " + p) tar.extract(p, dst) + shutil.move(os.path.join(dst, p), fp) tar.close() +shutil.rmtree(os.path.join(dst, 'cargo-nightly-' + triple)) diff --git a/src/etc/print-new-snapshot.py b/src/etc/print-new-snapshot.py index f6b3fe04f..5ddb34bab 100644 --- a/src/etc/print-new-snapshot.py +++ b/src/etc/print-new-snapshot.py @@ -11,13 +11,21 @@ print(date) if not os.path.isdir('target/dl'): os.makedirs('target/dl') -snaps = ['mac', 'linux', 'win'] -for snap in snaps: - tarball = 'cargo-nightly-' + snap + '.tar.gz' +snaps = { + 'macos-i386': 'i686-apple-darwin', + 'macos-x86_64': 'x86_64-apple-darwin', + 'linux-i386': 'i686-unknown-linux-gnu', + 'linux-x86_64': 'x86_64-unknown-linux-gnu', + 'winnt-i386': 'i686-pc-mingw32', +} + +for platform in sorted(snaps): + triple = snaps[platform] + tarball = 'cargo-nightly-' + triple + '.tar.gz' url = 'http://static.rust-lang.org/cargo-dist/' + date + '/' + tarball dl_path = "target/dl/" + tarball ret = subprocess.call(["curl", "-s", "-o", dl_path, url]) if ret != 0: raise Exception("failed to fetch url") h = hashlib.sha1(open(dl_path, 'rb').read()).hexdigest() - print(' ' + snap + ' ' + h) + print(' ' + platform + ' ' + h) diff --git a/src/snapshots.txt b/src/snapshots.txt index 7869ab791..d757ae812 100644 --- a/src/snapshots.txt +++ b/src/snapshots.txt @@ -1,3 +1,10 @@ +2014-07-30 + linux-i386 4d4e78426060b891cf729d5e3cca86d5aebdd31d + linux-x86_64 2a39bb838bc1c740d41a2ee8054a2c32f1efbec8 + macos-i386 16d1581dad71b1cf551646bc2dfdc920f4dda16c + macos-x86_64 05d836f2195e55f050e68e8bb209405a67fbefcb + winnt-i386 ade95f921ba73848d2ae67d1b8cd7c364e881e86 + 2014-07-29 mac 53f8bc39132e987d25e022698c3234fee0916ecf linux b7dbdc89126577fda2eef7d63c5f7fc1d8d28f99 -- 2.30.2